/***********************************************************************
 * Module:  ControlPointController.java
 * Author:  Administrator
 * Purpose: Defines the Class ControlPointController
 ***********************************************************************/

package ishitong.rvims.control.controller;

import ishitong.rvims.basic.service.RoadSectionService;
import ishitong.rvims.control.service.ControlPointService;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import ishitong.rvims.domain.basic.RoadSection;
import ishitong.rvims.domain.control.ControlPoint;
import ishitong.core.common.ActionController;
import ishitong.core.common.SQLSelectWhere;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/** @pdOid 2ddc9f8b-90d8-480c-bd8f-37a66f056487 */
@Controller
public class ControlPointController extends ActionController {
   /** @pdOid 425cdb2f-352e-427b-b827-d11dd19c885d
       @pdRoleInfo migr=yes name=RoadSectionService assc=association5 */
   @Autowired
   private RoadSectionService roadSectionService;
   /** @pdOid 9753a063-93f4-4cbd-8bc6-1e9acf187bfa
       @pdRoleInfo migr=yes name=ControlPointService assc=association6 */
   @Autowired
   private ControlPointService controlPointService;
   
   /** @param request 
    * @param response
    * @exception Exception
    * @pdOid 51f6457f-e328-44ad-87c2-858cd68d1179 */
   @RequestMapping(value = "/ajaxShowControlPointDialog.do")
   public ModelAndView handleAjaxShowControlPointDialog(HttpServletRequest request, HttpServletResponse response) throws Exception {
   	try {
   		Map<String, Object> model = new HashMap<String, Object>();
   		List<RoadSection> listRoadSection = roadSectionService.findRoadSectionList(null);
   		model.put("listRoadSection", listRoadSection);
   		return new ModelAndView("control/ControlPointDialog", model);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   	return null;
   }
   
   /** @param request 
    * @param response 
    * @param sQLSelectWhere
    * @exception Exception
    * @pdOid 5fd09d22-f8a7-4e2e-beb9-9b73e707fba3 */
   @RequestMapping(value = "/ajaxFindControlPointListForSelect.do")
   public ModelAndView handleAjaxFindControlPointListForSelect(HttpServletRequest request, HttpServletResponse response, SQLSelectWhere sQLSelectWhere) throws Exception {
   	try {
   		Map<String, Object> model = new HashMap<String, Object>();
   		List<ControlPoint> listControlPointLeft = controlPointService.findControlPointList(sQLSelectWhere);
   		model.put("listControlPointLeft", listControlPointLeft);
   		return new ModelAndView("control/ControlPointListForSelect", model);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   	return null;
   }

}